<?php

class BarcodeAction extends Action
{
    public function index()
	{
		header("Content-Type:text/html; charset=utf-8");
		$barcode = $_REQUEST['barcode'];
		if($barcode)
		{
			$model = M('Stkmas');
			$stkinfo = $model->field('id,stk_c,title,uom,price_sales,price_pur,spec,madein')->where('status_flg=\'Y\' and stk_c=\''.$barcode.'\'')->order('id desc')->find();
			if($stkinfo)
			{
				$result['msg']='ok';
				$result['data']=$stkinfo;
			}
			else
			{
				$result['msg']='条形码不存在：'.$barcode;
				$result['data']='';
			}
		}
		else
		{
				$result['msg']='条形码为空';
				$result['data']='';
		}		
		//var_dump($result);echo $model->getLastSql();exit;
		$jsonencode = json_encode($result);
		echo $jsonencode;
    }
	
	

}
?>